import axios from "axios";
export const baseUrl = "http://120.78.132.92:4399";

import store from "@/store";

const request = axios.create({
    baseURL: baseUrl,
});

request.interceptors.request.use((config) => {
    if (["post", "delete", "put", "patch"].includes(config.method)) {
        const { userInfo } = store.getState();
        config.headers.Authorization = userInfo.authorization;
    }
    return config;
});

export default request;
